#include <iostream>
class Account {
public:
    Account(double balance) : balance_(balance) {}

    // `getBalance`是一个const成员函数，不修改任何成员变量
    double getBalance() const {
        return balance_;
    }

    // 存款函数，修改成员变量
    void deposit(double amount) {
        balance_ += amount;
    }

private:
    double balance_;
};

int main() {
    const Account myAccount(1000.0);
    double myBalance = myAccount.getBalance();  // 可以在const对象上调用
    std::cout << "Balance: $" << myBalance << std::endl;

     myAccount.deposit(500.0);  // 编译错误：不能在const对象上调用非const成员函数
    return 0;
}